import 'package:flutter/material.dart';
import 'package:get/get_state_manager/get_state_manager.dart';
import 'package:razer_one/app/main/constants/color_constants.dart';
import 'package:razer_one/app/main/extension/int_double_extension.dart';
import 'package:razer_one/app/main/view/main_btn.dart';
import 'package:razer_one/app/main/view/main_text.dart';
import 'package:razer_one/app/main/view/main_textfield.dart';
import 'package:razer_one/app/modules/me/login/login_controller.dart';

class LoginPage extends GetView<LoginController> {
  const LoginPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GetBuilder<LoginController>(builder: (_) {
      return Scaffold(
          backgroundColor: Colors.white,
          body: GestureDetector(
            behavior: HitTestBehavior.translucent,
            onTap: () {
              FocusScope.of(context).requestFocus(FocusNode());
            },
            child: MediaQuery.removePadding(
                removeTop: true,
                context: context,
                child: ListView(
                  children: [
                    Image.asset("lib/app/resource/images/other/earth.png",
                        height: 240.px,
                        width: double.infinity,
                        fit: BoxFit.cover),
                    Padding(
                      padding: const EdgeInsets.all(20),
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          const MainText(
                            "  用户名",
                            textColor: Color(kBlueColor),
                          ),
                          sizeH(5),
                          MainTextField(
                            "请输入用户名",
                            _.usernameTfController,
                          ),
                          sizeH(_.marginY),
                          const MainText("  登录密码",
                              textColor: Color(kBlueColor)),
                          sizeH(5),
                          MainTextField(
                            "请输入登录密码",
                            _.passwordTfController,
                            isPasswod: true,
                          ),
                          sizeH(_.marginY),
                          MainCommitBtn(
                            "登录",
                            handle: _.loginBtnClick,
                            btnW: double.infinity,
                          ),
                          sizeH(10),
                          Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              MainTextBtn("注册账号",
                                  textNormalColor: const Color(kGoldenColor),
                                  btnW: 80,
                                  handle: _.registerBtnClick),
                              // MainTextBtn("找回密码",
                              //     textNormalColor: const Color(kGoldenColor),
                              //     btnW: 80,
                              //     handle: _.forgetPassWord),
                            ],
                          )
                        ],
                      ),
                    )
                  ],
                )),
          ));
    });
  }
}
